package solution1.demo;


public class Solution14 {

    private volatile static Object value = new Object();

    public static Object getValue() {
        return value;
    }

    private Solution14() {
    }

}

//懒汉
class SingletonLazy {

    private volatile static Object value = null;

    public static Object getValue() {
        if(value == null) {
            synchronized(SingletonLazy.class) {
                if(value == null) {
                    value = new Object();
                }
            }
        }
        return value;
    }

}

class Main {
    public static void main(String[] args) {
        Object value = Solution14.getValue();
    }
}
